<template>
  <div class="box5">
    <div class="title">
      <p>未来七天游客数量趋势图</p>
      <img src="../../images/dataScreen-title.png" alt="" />
    </div>
    <div class="echarts" ref="line"></div>
  </div>
</template>

<script setup lang="ts">
import * as echarts from 'echarts'
import { onMounted, ref } from 'vue'
let line = ref()
onMounted(() => {
  let myecharts = echarts.init(line.value)
  myecharts.setOption({
    title: {
      text: '访问量',
    },
    xAxis: {
      type: 'category', //区分不同数据类别，可以使数据均匀分布
      boundaryGap: false, //x轴两侧不留白
      splitLine: {
        show: false, //分割线不显示
      },
      data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
      axisTick: {
        show: true,
      },
    },
    yAxis: {
      //分割线不显示
      splitLine: {
        show: false,
      },
      //轴线
      axisLine: {
        show: true,
      },
      // 刻度
      axisTick: {
        show: true,
      },
    },
    grid: {
      top: 30,
      bottum: 0,
      left: 40,
    },
    series: {
      type: 'line',
      data: [0, 120, 304, 240, 44, 77, 99],
      smooth: true, //设置成平滑曲线
    },
  })
})
</script>

<style scoped lang="scss">
.box5 {
  width: 96%;
  height: 100%;
  background: url('../../images/dataScreen-main-cb.png') no-repeat;
  background-size: 100% 100%;
  margin: 0 20px;
  .title {
    margin-left: 15px;
    p {
      color: white;
      font-size: 20px;
    }
  }
  .echarts {
    width: 94%;
    height: 90%;
    margin-top: 10px;
  }
}
</style>
